import EventCenter from "../../TFrame/script/helper/EventCenter";
import EventNames from "../EventNames";
import TurnTableSystem from "../system/TurnTableSystem";

const { ccclass, property } = cc._decorator;

@ccclass
export default class TurnButtonAni extends cc.Component {

    @property(cc.Node)
    turnNode: cc.Node = null;

    @property(cc.Node)
    redNode:cc.Node = null;

    start() {
        cc.tween(this.turnNode)
            .repeatForever(
                cc.tween(this.turnNode).by(2, { angle: 720 })
                    .delay(2)
            )
            .start()
        this.redNode.active = (TurnTableSystem.isNoBlood() == false)

        EventCenter.on(EventNames.TurnTableSpinDone, ()=>{
            this.redNode.active = (TurnTableSystem.isNoBlood() == false)
        }, this)
    }

}
